package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.Scenic;
import cn.wolfcode.luowowo.article.mapper.ScenicMapper;
import cn.wolfcode.luowowo.article.query.ScenicQuery;
import cn.wolfcode.luowowo.article.service.IScenicService;
import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
import java.util.List;

@Service
public class ScenicServiceImpl implements IScenicService {
    @Autowired
    private ScenicMapper scenicMapper;

    @Override
    public List replyNumTop5(Long destId) {
        return scenicMapper.replyNumTop5(destId);
    }

    @Override
    public PageInfo query(ScenicQuery qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        List<Scenic> scenics = scenicMapper.selectAll();
        return new PageInfo(scenics);
    }

    @Override
    public Scenic selectById(Long scenicId) {
        Scenic scenic = scenicMapper.selectByPrimaryKey(scenicId);
        return scenic;
    }
}
